<template>
  <div class="app-container home">
    <!-- 系统总览 -->
    <SystemOverview :info="info" />
    <!-- 订单总览 -->
    <OrderOverview :info="info" />
    <!-- 代理商7天出货统计 -->
    <StatGraph :info="info" />
  </div>
</template>

<script>
import SystemOverview from './home/systemOverview.vue';
import OrderOverview from './home/orderOverview.vue'
import StatGraph from './home/statGraph.vue'
import { getHomeInfo } from '../api/home.js'
import moment from 'moment'
export default {
  components:{
    SystemOverview,
    OrderOverview,
    StatGraph
  },
  data() {
    return {
      info:{}
    };
  },
  mounted(){
    getHomeInfo().then(res=>{
      if(res.code == 200){
        this.info = res.data
        if(res.data.agentInfoList){
          this.info.agentInfoList = res.data.agentInfoList.map(item=>{
            return{
              ...item,
              extraInfo:item.extraInfo ? item.extraInfo : 0,
              payAmount:item.payAmount ? item.payAmount : 0,
              createdTime:moment(item.createdTime).format('MM/DD')
            }
          })
        }
      }
    })
  },
};
</script>

<style scoped lang="scss">
.home{
  
}

</style>

